using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication11.Models.Mapping
{
    public class roleMap : EntityTypeConfiguration<role>
    {
        public roleMap()
        {
            // Primary Key
            this.HasKey(t => t.role_id);

            // Properties
            this.Property(t => t.role_name)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.role_desc)
                .HasMaxLength(100);

            this.Property(t => t.role_name_en_US)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("role");
            this.Property(t => t.role_id).HasColumnName("role_id");
            this.Property(t => t.role_name).HasColumnName("role_name");
            this.Property(t => t.role_desc).HasColumnName("role_desc");
            this.Property(t => t.role_name_en_US).HasColumnName("role_name!en-US");
        }
    }
}
